/* eslint-disable */
export default {
  data() {
    return {
      // 资产数据
      assetData:[
        {
          contractNo: '0001201911025861',
          assetName: '办公桌',
          assetType: '办公用品',
          assetNorm: '型号:XXX',
          supplier: 'XXXX供应商',
          purchaseUnit: '购买单位',
          inboundDate: '2019-10-30',
          assetNum: '3',
          includesTax: true,
          fixedAssets: false,
          assetUseYear: '',
          assetStatus: '已审核',
          taxIncludedPrice: '600',
          excludingTaxPrice: '',
        },
        {
          contractNo: '0001201911025031',
          assetName: '办公椅子',
          assetType: '办公用品',
          assetNorm: '型号:XXX',
          supplier: 'XXXX供应商',
          purchaseUnit: '购买单位',
          inboundDate: '2019-10-30',
          assetNum: '1',
          includesTax: true,
          fixedAssets: false,
          assetUseYear: '',
          assetStatus: '已审核',
          taxIncludedPrice: '200',
          excludingTaxPrice: '',
        },
        {
          contractNo: '0001201911025031',
          assetName: '文件夹',
          assetType: '办公用品',
          assetNorm: '型号:XXX',
          supplier: 'XXXX供应商',
          purchaseUnit: '购买单位',
          inboundDate: '2019-10-30',
          assetNum: '1',
          includesTax: true,
          fixedAssets: false,
          assetUseYear: '',
          assetStatus: '待审核',
          taxIncludedPrice: '200',
          excludingTaxPrice: '',
        },
        {
          contractNo: '0001201911024234',
          assetName: '办公椅',
          assetType: '办公用品',
          assetNorm: '型号:XXX',
          supplier: 'XXXX供应商',
          purchaseUnit: '购买单位',
          inboundDate: '2019-10-30',
          assetNum: '5',
          includesTax: true,
          fixedAssets: false,
          assetUseYear: '',
          assetStatus: '已审核',
          children: [],
          taxIncludedPrice: '700',
          excludingTaxPrice: '',
        },
        {
          contractNo: '0001201911024234',
          assetName: '笔记本',
          assetType: '办公用品',
          assetNorm: '型号:XXX',
          supplier: 'XXXX供应商',
          purchaseUnit: '购买单位',
          inboundDate: '2019-10-30',
          assetNum: '1',
          includesTax: true,
          fixedAssets: false,
          assetUseYear: '',
          assetStatus: '已审核',
          taxIncludedPrice: '200',
          excludingTaxPrice: '',
        },
        {
          contractNo: '0001201911027165',
          assetName: '签字笔',
          assetType: '办公用品',
          assetNorm: '型号:XXX',
          supplier: 'XXXX供应商',
          purchaseUnit: '购买单位',
          inboundDate: '2019-10-30',
          assetNum: '2',
          includesTax: true,
          fixedAssets: false,
          assetUseYear: '',
          assetStatus: '已审核',
          children: [],
          taxIncludedPrice: '100',
          excludingTaxPrice: '',
        },
      ],

      // 资产图片上传
      dialogImageUrl: '',
      dialogVisible: false,
      disabled: false,

      // 新增资产弹窗
      dialogAssetAdd:{
        title: '资产维修',
        status: false,
      },

      // 新增资产表单数据
      assetAddFrom:{
        assetName: '',
        assetType: '',
        inboundDate: '',
        assetNorm: '',
        assetNum: '',
        includesTax: true,
        supplier: '',
        contractNo: '',
        purchaseUnit: '',
        fixedAssets: false,
        assetUseYear: '',
        taxIncludedPrice: '', // 含税价
        excludingTaxPrice: '', // 不含税价
      },

      // 新增资产表单验证
      assetAddRules: {
        assetName: [
          { required: true, message: '请输入资产名称', trigger: 'blur' },
        ],
        assetType: [
          { required: true, message: '请选择资产类型', trigger: 'change' },
        ],
      },

      // 资产维修表单
      uerFrom:{
        assetId: '',
        providerName: '',
        providerContact: '',
        providerTel: '',
        reason: '',
      },

      // 资产维修
      dialogAssetUse:{
        title: '资产维修',
        status: false,
      },

      //  资产维修表单验证
      userRules: {
        assetId: [
          { required: true, message: '请输入资产ID', trigger: 'blur' },
        ],
        providerName: [
          { required: true, message: '请输入提供商名称', trigger: 'blur' },
        ],
        providerContact: [
          { required: true, message: '请输入提供商联系人', trigger: 'blur' },
        ],
        providerTel: [
          { required: true, message: '请输入联系方式', trigger: 'blur' },
        ],
        reason: [
          { required: true, message: '请输入维修原因', trigger: 'blur' },
        ],
      },
    }
  },
  mounted() {

  },
  methods: {
    // 资产弹窗
    dialogAsset(row){
      this.assetAddFrom = row
      this.dialogAssetAdd.status = true
    },

    // 资产照片上传
    uploadFuc(){
      this.$message({
        type: 'success',
        message: '上传失败!'
      })
    },
    successFuc(){
      this.$message({
        type: 'success',
        message: '上传成功!'
      })
    },
    handleRemove(file) {
      console.log(file);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },

    // 资产维修弹窗
    dialogUse(row){
      this.uerFrom = {
        assetId: row.contractNo,
        providerName: '',
        providerContact: '',
        providerTel: '',
        reason: '',
      },
      this.dialogAssetUse.status = true
    },

    // 资产维修
    assetUse(formName){
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.$message({
            type: 'success',
            message: '维修申请成功!'
          })
          this.dialogAssetUse.status = false
        } else {
          this.$message({
            type: 'warning',
            message: '请填写相关信息!'
          })
          return false;
        }
      });
    }
  }
}